package com.frxuexi.shop.adapter

import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.CartBeanItem
import com.frxuexi.lib_base.utils.GlideUtils
import com.frxuexi.shop.R
import com.frxuexi.shop.databinding.ItemCarBinding

class CartAdapter:BaseQuickAdapter<CartBeanItem,BaseViewHolder>(R.layout.item_car) {

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemCarBinding>(viewHolder.itemView)
    }

    override fun convert(helper: BaseViewHolder, item: CartBeanItem) {
        val binding = DataBindingUtil.getBinding<ItemCarBinding>(helper.itemView)!!
        binding.bean=item
        GlideUtils.loadRoundImage(item.image,binding.carImage)
        binding.carCheckBox.isChecked=item.isCheck
    }
}